<template>
  <div>
    <Hwex4
      v-for="(obj, index) in list"
      :key="index"
      :ImgUrl="obj.dogImgUrl"
      :Name="obj.dogName"
      @clickFn="like"
    ></Hwex4>

    <p>您喜欢的狗：</p>
    <ul>
      <li v-for="(val, index) in arr" :key="index">
        {{ val }}
      </li>
    </ul>
  </div>
</template>

<script>
import Hwex4 from "./components/Hwex4";
export default {
  data() {
    return {
      list: [
        {
          dogImgUrl:
            "http://nwzimg.wezhan.cn/contents/sitefiles2029/10146688/images/21129958.jpg",
          dogName: "博美",
        },
        {
          dogImgUrl:
            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1224576619,1307855467&fm=26&gp=0.jpg",
          dogName: "泰迪",
        },
        {
          dogImgUrl:
            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2967740259,1518632757&fm=26&gp=0.jpg",
          dogName: "金毛",
        },
        {
          dogImgUrl:
            "https://pic1.zhimg.com/80/v2-7ba4342e6fedb9c5f3726eb0888867da_1440w.jpg?source=1940ef5c",
          dogName: "哈士奇",
        },
        {
          dogImgUrl:
            "https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00645-2858.jpg",
          dogName: "阿拉斯加",
        },
        {
          dogImgUrl:
            "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1223113064,2093239935&fm=26&gp=0.jpg",
          dogName: "萨摩耶",
        },
      ],

      // 定义一个新空数组，值是子传父过来的list的dogName，在右侧显示
      arr: [],
    };
  },

  methods: {
    like(Name) {
      this.arr.push(Name);
    },
  },

  components: {
    Hwex4,
  },
};
</script>

<style>
</style>